package com.woniu.dao;

import com.woniu.model.EArtical;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 文章表 Mapper 接口
 * </p>
 *
 * @author Kevin Kwok
 * @since 2021-04-16
 */
public interface EArticalMapper extends BaseMapper<EArtical> {

    @Insert("insert into e_artical(title,content,type) values(#{title},#{content},#{typeId}); ")
    int addNewArtical(String title,String content,Integer typeId);

    @Update("update e_artical set title=#{title},content=#{content},type=#{typeId} where id=#{id}")
    int editNewArtical(String title,String content,Integer typeId,Integer id);

    @Delete("delete from e_artical where id=#{id}")
    int deleteArtical(Integer id);

    @Select("select * from e_artical")
    List<EArtical> queryAll();
}
